<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>栏目管理</title>
<t:base type="jquery,easyui,tools"></t:base>
<script type="text/javascript">
	$(function() {
		$('#cc').combotree({
			url : 'columnsController.do?setPFunction&selfId=${columns.columnsId}',
            width: 155,
            onSelect : function(node) {
//               alert(node.text);

                var pId = "";
                if(node.id != ""){
                    pId = node.id;
                }
                $("#patentIds").val(node.attributes.href);
                $("#pId").val(pId);

            }
        });

        if($("#id").val() != "") {
            $('#cc').combotree('disable');
        }

        if($("#pId").val() == ""){
//            $("#pId").val("0");
        }

        if($("#cc").val() == ""){
            $('#cc').combotree('setValue', '');
        }

        if('${empty pid}' == 'false') { // 设置新增页面时的父级

            $('#cc').combotree('setValue', '${pid}');

        }
	});

    function f_beforeSubmit(){


        var t = $("#cc").combotree('tree'); // 得到树对象

        var n = t.tree('getSelected'); // 得到选择的节点

        if(n != null && n.attributes['href'] != ""){
            tip("最多只能有两层,请重新选择上级分类");
            return false;
        }


        return true;
    }

</script>
</head>
<body style="overflow-y: hidden" scroll="no">
<t:formvalid formid="formobj" layout="div" dialog="true" action="columnsController.do?save" beforeSubmit="f_beforeSubmit">
	<input id="id" name="columnsId" type="hidden" value="${columns.columnsId }">
	<input id="patentIds" name="patentIds" type="hidden" value="${columns.patentIds }">
	<fieldset class="step">
        <div class="form">
            <label class="Validform_label"> 标题: </label>
            <input name="title" class="inputxt" value="${columns.title }"  datatype="s1-6" validType="a_columns,title,columns_id,deleted=0">
            <span class="Validform_checktip">标题范围1~6位字符</span>
        </div>

        <div class="form">
            <label class="Validform_label"> 是否引导偏好: </label>
            <select name="guidePrefer" id="guidePrefer">
                <option value="1" <c:if test="${columns.guidePrefer=='1'}">selected="selected"</c:if>>是</option>
                <option value="0" <c:if test="${columns.guidePrefer=='0'}">selected="selected"</c:if>>否</option>
            </select>
        </div>
        <div class="form">
            <label class="Validform_label"> 是否默认: </label>
            <select name="isDef" id="isDef">
                <option value="1" <c:if test="${columns.isDef=='1'}">selected="selected"</c:if>>是</option>
                <option value="0" <c:if test="${columns.isDef=='0'}">selected="selected"</c:if>>否</option>
            </select>
        </div>
        <div class="form">
            <label class="Validform_label"> 是否有效: </label>
            <select name="enable" id="enable">
                <option value="1" <c:if test="${columns.enable=='1'}">selected="selected"</c:if>>是</option>
                <option value="0" <c:if test="${columns.enable=='0'}">selected="selected"</c:if>>否</option>
            </select>
        </div>
        <div class="form">
            <label class="Validform_label"> 排序: </label>
            <input name="sort"  class="easyui-numberbox" style="height: 22px;width: 152px;" min="0" value="${columns.sort == null ? 0 : columns.sort }" >
        </div>
        <%--<div class="form">--%>
            <%--<label class="Validform_label"> 排序规则: </label>--%>
            <%--&lt;%&ndash;<t:dictSelect field="sortType"  type="select" typeGroupCode="sortType" defaultVal="${columns.sortType}"&ndash;%&gt;--%>
                          <%--&lt;%&ndash;hasLabel="false" extendJson="{datatype='*'}" >&ndash;%&gt;--%>
            <%--&lt;%&ndash;</t:dictSelect>&ndash;%&gt;--%>
            <%--&lt;%&ndash;<input name=""  class="easyui-numberbox" style="height: 22px;width: 152px;" min="0" value="${.sortType }" >&ndash;%&gt;--%>
            <%--<select name="sortType" id="sortType">--%>
                <%--<option value="11" <c:if test="${columns.sortType=='11'}">selected="selected"</c:if>>时间线排序</option>--%>
                <%--<option value="12" <c:if test="${columns.sortType=='12'}">selected="selected"</c:if>>热度排序</option>--%>
            <%--</select>--%>
        <%--</div>--%>
        <div class="form">
            <label class="Validform_label"> 上级分类: </label>
            <input id="cc" name="cc" value="${columns.aColumnsEntity.columnsId}">
            <input type="hidden" id="pId" name="aColumnsEntity.columnsId" value="${columns.aColumnsEntity.columnsId}">
        </div>
        <div class="form">
            <label class="Validform_label"> 简介: </label>
            <textarea id="intro" name="intro" class="inputxt" rows="3">${columns.intro }</textarea>
        </div>
	</fieldset>
</t:formvalid>
</body>
</html>
